package com.nbsaas.boot.queue.task;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

public class TaskMetadata {
    private final Map<String, Object> data;
    private LocalDateTime createTime;
    private LocalDateTime startTime;
    private LocalDateTime endTime;
    private String errorMessage;
    private String stackTrace;

    public TaskMetadata() {
        this.data = new HashMap<>();
        this.createTime = LocalDateTime.now();
    }

    public void setError(String errorMessage, String stackTrace) {
        this.errorMessage = errorMessage;
        this.stackTrace = stackTrace;
    }

    public void put(String key, Object value) {
        data.put(key, value);
    }

    public Object get(String key) {
        return data.get(key);
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public LocalDateTime getStartTime() {
        return startTime;
    }

    public void setStartTime(LocalDateTime startTime) {
        this.startTime = startTime;
    }

    public LocalDateTime getEndTime() {
        return endTime;
    }

    public void setEndTime(LocalDateTime endTime) {
        this.endTime = endTime;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public String getStackTrace() {
        return stackTrace;
    }

    public Map<String, Object> getData() {
        return new HashMap<>(data);
    }
} 